﻿import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Window
import FilUI

Page {
    id: control

    property int launchMode                     : FilPageType.SingleTop
    property bool animationEnabled              : FilTheme.animationEnabled
    property string url                         : ""

    StackView.onRemoved                         : destroy()
    padding                                     : 5
    visible                                     : false
    opacity                                     : visible
    transform                                   : Translate {
        y                                       : control.visible ? 0 : 80
        Behavior on y {
            enabled                             : control.animationEnabled && FilTheme.animationEnabled
            NumberAnimation {
                duration                        : 167
                easing.type                     : Easing.OutCubic
            }
        }
    }
    Behavior on opacity {
        enabled                                 : control.animationEnabled && FilTheme.animationEnabled
        NumberAnimation {
            duration: 83
        }
    }
    background                                  : Item { }
    header                                      : Loader {
        sourceComponent                         : control.title === "" ? undefined : com_header
    }
    Component {
        id: com_header
        Item {
            implicitHeight                      : 40
            FilText {
                id: text_title
                text                            : control.title
                font                            : FilTextStyle.Title
                anchors {
                    left                        : parent.left
                    leftMargin                  : 5
                }
            }
        }
    }
    Component.onCompleted: {
        control.visible = true
    }
}
